package com.ceuer.demo.thread;

//创建线程方式2：Runnable，实现run()方法，调用start()方法开启线程
public class Demo2 implements Runnable{
	public static void main(String[] args) {
		Demo2 d2=new Demo2();
		Thread thread=new Thread(d2);
		thread.start();
		
		for (int i = 1; i <= 20; i++) {
			System.out.println("正在写代码"+i);
		}
	}
	
	@Override
	public void run() {
		for (int i = 1; i <= 20; i++) {
			System.out.println("正在看电视"+i);
		}
	}
}
